﻿<Application
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:c="clr-namespace:Robert.TwitBy.Converters"
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:vm="clr-namespace:Robert.TwitBy.ViewModels"
    xmlns:local="clr-namespace:Robert.TwitBy"
    mc:Ignorable="d"
	x:Class="Robert.TwitBy.App" ShutdownMode="OnLastWindowClose">
	<Application.Resources>
        <ResourceDictionary>       
            
            <!--BACKGROUNDS FOR THE APP-->
            <LinearGradientBrush x:Key="DirectBackground" StartPoint="0,0" EndPoint="0,1">
                <GradientStop Color="Coral" Offset="0"/>
                <GradientStop Color="#FFFFFFFF" Offset="1"/>
            </LinearGradientBrush>
            
            <LinearGradientBrush x:Key="MentionBackground" StartPoint="0,0" EndPoint="0,1">
                <GradientStop Color="GreenYellow" Offset="0"/>
                <GradientStop Color="#FFFFFFFF" Offset="1"/>
            </LinearGradientBrush>
            
            <LinearGradientBrush x:Key="DefaultBackground" StartPoint="0,0" EndPoint="0,1">
                <GradientStop Color="Wheat" Offset="0"/>
                <GradientStop Color="#FFFFFFFF" Offset="1"/>
            </LinearGradientBrush>
            
            <LinearGradientBrush x:Key="WindowBackground" StartPoint="0.5,0" EndPoint="0.5,1">
                <GradientStop Color="#FF66E597" Offset="1"/>
                <GradientStop Color="#FF007A66"/>
            </LinearGradientBrush>
            
            <LinearGradientBrush x:Key="ButtonIsEnabled" StartPoint="0,0" EndPoint="0,1">
                <GradientStop Color="#FFDDFFEA" Offset="0"/>
                <GradientStop Color="#FF00FF61" Offset="1"/>
            </LinearGradientBrush>
            
            <LinearGradientBrush x:Key="ButtonIsDisabled" StartPoint="0,0" EndPoint="0,1">
                <GradientStop Color="#FF959595" Offset="0"/>
                <GradientStop Color="#FFC9FFFE" Offset="1"/>
            </LinearGradientBrush>
            
            <LinearGradientBrush x:Key="ButtonIsMouseOver" StartPoint="0,0" EndPoint="0,1">
                <GradientStop Color="#FF65914D" Offset="0"/>
                <GradientStop Color="#FFEBFFFF" Offset="1"/>
            </LinearGradientBrush>
            
            <LinearGradientBrush x:Key="ButtonIsPressed" StartPoint="0,0" EndPoint="0,1">
                <GradientStop Color="#FF7E9587" Offset="0"/>
                <GradientStop Color="#FF009338" Offset="1"/>
            </LinearGradientBrush>
            
            <LinearGradientBrush x:Key="TwitByBackground" StartPoint="0,0" EndPoint="0,1">
                <GradientStop Color="#FF01037B" Offset="1"/>
                <GradientStop Color="#FF70E1FF"/>
            </LinearGradientBrush>
            
            <LinearGradientBrush x:Key="FavoriteBackground" StartPoint="0,0" EndPoint="0,1">
                <GradientStop Color="#FFE57474" Offset="1"/>
                <GradientStop Color="#FFEAFF70"/>
            </LinearGradientBrush>
            
            <!--CONVERTERS-->
            <c:TweetStatusConverter x:Key="TweetStatusConverter"/>
            <c:RemainingCharsConverter x:Key="RemainingCharsConverter" />
            <c:StatusSourceConverter x:Key="StatusSourceConverter"/>
            <c:TweetBackgroundConverter x:Key="TweetBackgroundConverter"/>
            <c:UserMentionConverter x:Key="UserMentionConverter"/>
            <c:TimeAgoConverter x:Key="TimeAgoConverter"/>
            
            <!--TWEET DATATEMPLATE-->
            <DataTemplate x:Key="Tweet">
                <Grid>
                    <Grid.Background>
                        <MultiBinding Converter="{StaticResource TweetBackgroundConverter}">
                            <Binding Path="IsMention"/>
                            <Binding Path="IsDirect"/>
                            <Binding Path="ID"/>
                            <Binding Path="IsFavorite"/>
                        </MultiBinding>
                    </Grid.Background>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="50"/>
                        <ColumnDefinition Width="*"/>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                    </Grid.RowDefinitions>
                    <Image Margin="3" 
                           RenderOptions.BitmapScalingMode="HighQuality"
                           Grid.Column="0" Grid.RowSpan="3"
                           VerticalAlignment="Top"
                           Source="{Binding ProfileImageURL}"
                           Width="50" Height="50"/>
                    <ContentControl Grid.Row="0" Grid.Column="1" Grid.ColumnSpan="2"
                                    FontSize="15" FontWeight="Bold"
                                    Content="{Binding User, Converter={StaticResource UserMentionConverter}}"/>
                    <ContentControl Grid.Row="1"  Grid.Column="1" Grid.ColumnSpan="2">
                        <MultiBinding Converter="{StaticResource TweetStatusConverter}">
                            <Binding Path="Status"/>
                            <Binding Path="ID"/>
                        </MultiBinding>
                    </ContentControl>
                    <StackPanel Orientation="Horizontal"
                                Grid.Column="1" Grid.Row="3">
                        <ContentControl FontSize="10">
                            <MultiBinding Converter="{StaticResource TimeAgoConverter}">
                                <Binding Path="TimeAgo"/>
                                <Binding Path="ID"/>
                            </MultiBinding>
                        </ContentControl>
                        <ContentControl FontSize="10"
                                        Content="{Binding Source, Converter={StaticResource StatusSourceConverter}}"/>
                    </StackPanel>
                </Grid>
            </DataTemplate>
            
            <!--RADIO BUTTON CONTROL TEMPLATE-->
            <ControlTemplate x:Key="RadioButtonControlTemplate" TargetType="{x:Type RadioButton}">
                <ControlTemplate.Resources>
                    <Storyboard x:Key="Selected">
                        <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Panel.Background).(GradientBrush.GradientStops)[1].(GradientStop.Color)" Storyboard.TargetName="border">
                            <SplineColorKeyFrame KeyTime="0" Value="#0000FF61"/>
                            <SplineColorKeyFrame KeyTime="0:0:0.5" Value="#FF00FF61"/>
                        </ColorAnimationUsingKeyFrames>
                        <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Panel.Background).(GradientBrush.GradientStops)[0].(GradientStop.Color)" Storyboard.TargetName="border">
                            <SplineColorKeyFrame KeyTime="0" Value="#00DDFFEA"/>
                            <SplineColorKeyFrame KeyTime="0:0:0.5" Value="#FFDDFFEA"/>
                        </ColorAnimationUsingKeyFrames>
                        <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)" Storyboard.TargetName="border">
                            <SplineColorKeyFrame KeyTime="0" Value="#008B8B8B"/>
                            <SplineColorKeyFrame KeyTime="0:0:0.5" Value="#FF8B8B8B"/>
                        </ColorAnimationUsingKeyFrames>
                    </Storyboard>
                </ControlTemplate.Resources>
                <Border x:Name="border" BorderBrush="#008B8B8B" BorderThickness="1" Margin="0">
                    <Border.Background>
                        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                            <GradientStop Color="#00000000" Offset="0"/>
                            <GradientStop Offset="1"/>
                        </LinearGradientBrush>
                    </Border.Background>
                    <ContentPresenter Margin="5,3" HorizontalAlignment="Center" VerticalAlignment="Center"/>                    
                </Border>
                <ControlTemplate.Triggers>
                    <MultiTrigger>
                        <MultiTrigger.ExitActions>
                            <RemoveStoryboard BeginStoryboardName="Selected_BeginStoryboard"/>
                        </MultiTrigger.ExitActions>
                        <MultiTrigger.Conditions>
                            <Condition Property="IsMouseOver" Value="True"/>
                            <Condition Property="IsChecked" Value="False"/>
                        </MultiTrigger.Conditions>
                        <MultiTrigger.EnterActions>
                            <BeginStoryboard x:Name="Selected_BeginStoryboard" Storyboard="{StaticResource Selected}"/>
                        </MultiTrigger.EnterActions>
                    </MultiTrigger>
                    <Trigger Property="IsChecked" Value="True">
                        <Trigger.ExitActions>
                            <RemoveStoryboard BeginStoryboardName="Selected_BeginStoryboard"/>
                        </Trigger.ExitActions>
                        <Trigger.EnterActions>
                            <BeginStoryboard x:Name="Selected_BeginStoryboard1" Storyboard="{StaticResource Selected}"/>
                        </Trigger.EnterActions>
                    </Trigger>
                </ControlTemplate.Triggers>
            </ControlTemplate>
            
            <ControlTemplate x:Key="ButtonControlTemplate" TargetType="{x:Type Button}">
                <Border x:Name="border" BorderBrush="#FF8B8B8B" BorderThickness="0.75">
                    <Grid x:Name="grid" Height="Auto" Width="Auto" Background="{DynamicResource ButtonIsEnabled}">
                        <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
                    </Grid>
                </Border>
                <ControlTemplate.Triggers>
                    <MultiTrigger>
                        <MultiTrigger.Conditions>
                            <Condition Property="IsMouseOver" Value="True"/>
                            <Condition Property="IsPressed" Value="True"/>
                        </MultiTrigger.Conditions>
                        <MultiTrigger.Setters>
                            <Setter Property="BorderThickness" TargetName="border" Value="2,2,1,1"/>
                        </MultiTrigger.Setters>
                    </MultiTrigger>
                    <Trigger Property="IsEnabled" Value="False">
                        <Setter Property="Background" TargetName="grid" Value="{StaticResource ButtonIsDisabled}"/>
                        <Setter Property="Background" TargetName="border" Value="#00000000"/>
                    </Trigger>
                    <Trigger Property="IsMouseOver" Value="True">
                        <Setter Property="Background" TargetName="grid" Value="{StaticResource ButtonIsEnabled}"/>
                    </Trigger>
                </ControlTemplate.Triggers>
            </ControlTemplate>
            
            <ControlTemplate x:Key="RefreshButtonControlTemplate" TargetType="{x:Type Button}">
                <ControlTemplate.Resources>
                    <Storyboard x:Key="Selected">
                        <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Panel.Background).(GradientBrush.GradientStops)[1].(GradientStop.Color)" Storyboard.TargetName="border">
                            <SplineColorKeyFrame KeyTime="0" Value="#0000FF61"/>
                            <SplineColorKeyFrame KeyTime="0:0:0.5" Value="#FF00FF61"/>
                        </ColorAnimationUsingKeyFrames>
                        <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Panel.Background).(GradientBrush.GradientStops)[0].(GradientStop.Color)" Storyboard.TargetName="border">
                            <SplineColorKeyFrame KeyTime="0" Value="#00DDFFEA"/>
                            <SplineColorKeyFrame KeyTime="0:0:0.5" Value="#FFDDFFEA"/>
                        </ColorAnimationUsingKeyFrames>
                        <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)" Storyboard.TargetName="border">
                            <SplineColorKeyFrame KeyTime="0" Value="#008B8B8B"/>
                            <SplineColorKeyFrame KeyTime="0:0:0.5" Value="#FF8B8B8B"/>
                        </ColorAnimationUsingKeyFrames>
                    </Storyboard>
                </ControlTemplate.Resources>
                <Border x:Name="border" BorderBrush="#008B8B8B" BorderThickness="1" Margin="0">
                    <Border.Background>
                        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                            <GradientStop Color="#00000000" Offset="0"/>
                            <GradientStop Offset="1"/>
                        </LinearGradientBrush>
                    </Border.Background>
                    <ContentPresenter Margin="5,3" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                </Border>
                <ControlTemplate.Triggers>
                    <MultiTrigger>
                        <MultiTrigger.ExitActions>
                            <RemoveStoryboard BeginStoryboardName="Selected_BeginStoryboard"/>
                        </MultiTrigger.ExitActions>
                        <MultiTrigger.Conditions>
                            <Condition Property="IsMouseOver" Value="True"/>
                        </MultiTrigger.Conditions>
                        <MultiTrigger.EnterActions>
                            <BeginStoryboard x:Name="Selected_BeginStoryboard" Storyboard="{StaticResource Selected}"/>
                        </MultiTrigger.EnterActions>
                    </MultiTrigger>
                    <Trigger Property="IsPressed" Value="True">
                        <Setter Property="BorderThickness" Value="2,2,1,1" TargetName="border"/>
                    </Trigger>
                </ControlTemplate.Triggers>
            </ControlTemplate>
            
            <!--STYLES-->
            <Style x:Key="ListBoxItemStyle" TargetType="{x:Type ListBoxItem}">
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type ListBoxItem}">
                            <ControlTemplate.Resources>
                                <Storyboard x:Key="MouseOver">
                                    <ThicknessAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Margin)" Storyboard.TargetName="presenter" BeginTime="0:0:0">
                                        <EasingThicknessKeyFrame KeyTime="0:0:0" Value="0"/>
                                        <EasingThicknessKeyFrame KeyTime="0:0:0.10" Value="0,3"/>
                                    </ThicknessAnimationUsingKeyFrames>
                                    <ColorAnimation Storyboard.TargetProperty="(Border.Background).(Color)" Storyboard.TargetName="grid" 
                                                    BeginTime="0:0:0" From="#00000000" To="#FF4357C6" Duration="0:0:0.15"/>
                                </Storyboard>
                                <Storyboard x:Key="UnMouseOver">
                                    <ThicknessAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Margin)" Storyboard.TargetName="presenter" BeginTime="0:0:0">
                                        <EasingThicknessKeyFrame KeyTime="0:0:0" Value="0,3"/>
                                        <EasingThicknessKeyFrame KeyTime="0:0:0.10" Value="0"/>
                                    </ThicknessAnimationUsingKeyFrames>
                                    <ColorAnimation Storyboard.TargetProperty="(Border.Background).(Color)" Storyboard.TargetName="grid" 
                                                    BeginTime="0:0:0" From="#FF4357C6" To="#00000000" Duration="0:0:0.15"/>
                                </Storyboard>
                                <Storyboard x:Key="Selected">
                                    <ThicknessAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Margin)" Storyboard.TargetName="presenter" BeginTime="0:0:0">
                                        <EasingThicknessKeyFrame KeyTime="0:0:0" Value="0"/>
                                        <EasingThicknessKeyFrame KeyTime="0:0:0.25" Value="0,8"/>
                                    </ThicknessAnimationUsingKeyFrames>
                                    <ColorAnimation Storyboard.TargetProperty="(Border.Background).(Color)" Storyboard.TargetName="grid" 
                                                    BeginTime="0:0:0" From="#00000000" To="#FF4357C6" Duration="0:0:0.50"/>
                                </Storyboard>
                                <Storyboard x:Key="UnSelected">
                                    <ThicknessAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Margin)" Storyboard.TargetName="presenter" BeginTime="0:0:0">
                                        <EasingThicknessKeyFrame KeyTime="0:0:0" Value="0,8"/>
                                        <EasingThicknessKeyFrame KeyTime="0:0:0.25" Value="0"/>
                                    </ThicknessAnimationUsingKeyFrames>
                                    <ColorAnimation Storyboard.TargetProperty="(Border.Background).(Color)" Storyboard.TargetName="grid" 
                                                    BeginTime="0:0:0" From="#FF4357C6" To="#00000000" Duration="0:0:0.50"/>
                                </Storyboard>
                                <!--<Storyboard x:Key="UnSelectedFast">
                                <ThicknessAnimationUsingKeyFrames Storyboard.TargetProperty="(Border.BorderThickness)" Storyboard.TargetName="grid" BeginTime="0:0:0">
                                <EasingThicknessKeyFrame KeyTime="0:0:0" Value="2,6"/>
                                <EasingThicknessKeyFrame KeyTime="0:0:0.25" Value="0"/>
                                </ThicknessAnimationUsingKeyFrames>
                                </Storyboard>-->
                            </ControlTemplate.Resources>
                            <Border CornerRadius="0" BorderThickness="0" Background="#00000000" x:Name="grid">
                                <ContentPresenter Margin="0" x:Name="presenter"/>
                            </Border>
                            <ControlTemplate.Triggers>
                                <Trigger Property="Selector.IsSelected" Value="True">
                                    <Trigger.EnterActions>
                                        <BeginStoryboard Storyboard="{StaticResource Selected}"/>
                                    </Trigger.EnterActions>
                                    <Trigger.ExitActions>
                                        <BeginStoryboard Storyboard="{StaticResource UnSelected}"/>
                                    </Trigger.ExitActions>
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
            
            <Style x:Key="ImageStyle" 
                   TargetType="{x:Type Image}">
                <Setter Property="RenderOptions.BitmapScalingMode"
                        Value="HighQuality"/>
            </Style>
            
            <Style x:Key="HyperlinkStyle" 
                   TargetType="{x:Type Hyperlink}">
                <Setter Property="TextDecorations" 
                        Value="{x:Null}"/>
            </Style>
            
            <Style x:Key="ButtonImageStyle" 
                   TargetType="{x:Type Image}">
                <Setter Property="RenderOptions.BitmapScalingMode"
                        Value="HighQuality"/>
                <Setter Property="Margin"
                        Value="3"/>
            </Style>
            
        </ResourceDictionary>
    </Application.Resources>
</Application>
    